package oj;

import java.util.Scanner;

/**
 * @author 郝文雪
 * @date 2022/7/18 22:51
 * @Description Test
 */
public class Day20公共子串计算 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            String s1=sc.nextLine();
            String s2=sc.nextLine();
            int n=s1.length();
            int m=s2.length();
            int[][] dp=new int[n+1][m+1];
            int maxLen=0;
            for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                    if(s1.charAt(i-1)==s2.charAt(j-1)){
                        dp[i][j]=dp[i-1][j-1]+1;
                    }
                    if(maxLen<dp[i][j]){
                        maxLen=dp[i][j];
                    }
                }
            }
            System.out.println(maxLen);
        }
    }
}
